/*
 *  sprite.h
 *  
 *  Created by James Dykstra
 *	Team 5
 *
 *  Copyright 2010 Michigan Technological University. All rights reserved.
 */
 
#ifndef SPRITE_H
#define SPRITE_H
#include "renderer.h"
#include "hitbox.h"

class Sprite
{
public:
	SDL_Rect*			getRect(){ return &position; };
	float				getAngle(){ return angle; };
	SDL_Surface*		getSurface(){ return image; };
	Hitbox*				getHitbox(){ return hitbox; };
	int					getRadius(){ return radius; };
	GLuint				getTexture(){ return texId; };
	SDL_Rect*			getDrawPos(){ return drawPos; };
	void				setAngle(float a){ angle = a; };
	Vector*				getCenterVector(){ return (new Vector((float)(position.x+hitbox->getCenter()->getX()), (float)(position.y+hitbox->getCenter()->getY()))); };
	Vector*				getSizeVector(){ return (new Vector(hitbox->getSize()->getX(), hitbox->getSize()->getY())); };

	virtual void 		show(int, int)=0;
	
protected:
	Renderer		*rnd;
	SDL_Surface		*image;
	SDL_Rect		*drawPos;
	SDL_Rect		position;
	GLuint			texId;
	GLfloat			angle;
	Hitbox			*hitbox;
	int			radius;
	SDL_Rect		*lastPos;
	GLfloat			lastAng;
	
	inline static double degreesToRadians(float d) {
		return d * 2 * M_PI / 360;
	}
	inline static float radiansToDegrees(double r) {
		return (float) (r*360 / (2 * M_PI));
	}

};

#endif
